// 导入 Layout 组件
import Layout from '@/layout'

// 在这个模块中，以对象的形式，存储动态菜单对应的路由规则
export default {
  // 键: 值
  // 菜单项的名字: 路由规则

  // 1. 组织架构的路由规则
  departments: {
    path: '/departments',
    component: Layout,
    children: [
      {
        path: '',
        // 要展示的子组件
        component: () => import('@/views/departments/index.vue'),
        meta: { title: '组织架构', icon: 'tree' }
      }
    ]
  },

  // 2. 公司设置
  settings: {
    path: '/settings',
    component: Layout,
    children: [
      {
        path: '',
        // 要展示的子组件
        component: () => import('@/views/settings/index.vue'),
        meta: { title: '公司设置', icon: 'setting' }
      }
    ]
  },

  // 3. 权限管理
  permissions: {
    path: '/permissions',
    component: Layout,
    children: [
      {
        path: '',
        // 要展示的子组件
        component: () => import('@/views/permissions/index.vue'),
        meta: { title: '权限管理', icon: 'lock' }
      }
    ]
  },

  // 4. 员工
  employees: {
    path: '/employees',
    component: Layout,
    children: [
      {
        path: '',
        // 要展示的子组件【员工列表的组件】
        component: () => import('@/views/employees/index.vue'),
        meta: { title: '员工管理', icon: 'people' }
      },
      {
        // 嵌套子路由的 path 有两种写法：
        // 完整写法：父 + 子
        // 简化写法：省略父路由的 path，同时子路由的 path 不要以 / 开头
        path: 'import',
        // 批量导入员工的组件页面
        component: () => import('@/views/employees/ImportEmp.vue'),
        meta: { title: '员工批量导入' },
        // 不把员工批量导入渲染为左侧菜单
        hidden: true
      },
      {
        path: 'empdetail/:id',
        component: () => import('@/views/employees/EmpInfo.vue'),
        hidden: true,
        meta: { title: '员工详情' }
      }
    ]
  },

  // 5. 社保
  social_securitys: {
    path: '/social_securitys',
    component: Layout,
    children: [
      {
        path: '',
        // 要展示的子组件
        component: () => import('@/views/social_securitys/index.vue'),
        meta: { title: '社保', icon: 'table' }
      }
    ]
  },

  // 6. 工资
  salarys: {
    path: '/salarys',
    component: Layout,
    children: [
      {
        path: '',
        // 要展示的子组件
        component: () => import('@/views/salarys/index.vue'),
        meta: { title: '工资', icon: 'money' }
      }
    ]
  },

  // 7. 考勤
  attendances: {
    path: '/attendances',
    component: Layout,
    children: [
      {
        path: '',
        // 要展示的子组件
        component: () => import('@/views/attendances/index.vue'),
        meta: { title: '考勤', icon: 'skill' }
      }
    ]
  },

  // 8. 审批
  approvals: {
    path: '/approvals',
    component: Layout,
    children: [
      {
        path: '',
        component: () => import('@/views/approvals/index'),
        meta: { title: '审批', icon: 'tree-table' }
      }
    ]
  }
}
